<?php if($error == false) {?>

<table width="700px">
	<tbody>
		<tr>
			<td width="100%">
				<table align="center" width="100%">
					<tbody>
						<tr>
							<td valign="top" style="text-align:left" width="50%">
								<b>TESRENG FEDERAL PAINT COMPANY</b><br>
								Tel: 012 855 424 - 097 97 37 222<br>
								Email: tesreng@gmail.com
							</td>
							<td valign="top" style="text-align:right" width="50%">
								<h2 style="padding:5px; float:right; margin-bottom:10px">PURCHASE ORDER</h2>
								<div style="clear:both"></div>
								<div style="float:right; text-align:left">
									<table>
										<tr>
											<th><?php echo $this->document->text['text_date']?>:</th>
											<td><?php echo $order['orderdate']?></td>
										</tr>
										<tr>
											<th>Order No:</th>
											<td><?php echo $order['ordernumber']?></td>
										</tr>
										<tr>
											<th>Creator:</th>
											<td><?php echo $employee['fullname']?></td>
										</tr>
									</table>
								</div>
								<div style="clear:both"></div>
							</td>
						</tr>
					</tbody>
				</table>
				
				<table width="100%" cellpadding="5" align="center">
					<tbody>
						<tr>
							<th width="15%">Vendor</th><td colspan="3" width="85%" style="border-bottom:1px dotted #000000">: <?php echo $partner['fullname']?></td>
						</tr>
						<tr>
							<th width="15%"><?php echo $this->document->text['text_address']?></th><td colspan="3" width="85%" style="border-bottom:1px dotted #000000">: <?php echo $partner['address']?></td>
						</tr>
						<tr>
							<th width="15%"><?php echo $this->document->text['text_tel']?>:</th>
							<td width="35%" style="border-bottom:1px dotted #000000">: <?php echo $partner['phone']?></td>
							<th width="15%"><?php echo $this->document->text['text_fax']?></th>
							<td width="35%" style="border-bottom:1px dotted #000000">: <?php echo $partner['fax']?></td>
						</tr>
						<tr>
							<th width="10%">Tax code</th>
							<td width="35%" style="border-bottom:1px dotted #000000">: <?php echo $partner['taxcode']?></td>
							<th width="15%">Payment</th>
							<td width="35%" style="border-bottom:1px dotted #000000">: <?php echo $order['paymenttype']?></td>
						</tr>
					</tbody>
				</table>
				<br>
				<table class="grid" style="width:700px" align="center" cellpadding="5" cellspacing="0">
					<thead style="font-weight:bold">
						<th width="5%">No.</th>
						<th width="30%"><?php echo $this->document->text['text_description']?>:</th>
						<th width="7%"><?php echo $this->document->text['text_qty']?></th>
						<th width="15%"><?php echo $this->document->text['text_unitprice']?></th>
						<th width="15%">SubTotal</th>
						<th width="8%"><?php echo $this->document->text['text_tax']?></th>
						<th width="20%">Total</th>
					</thead>
					<tbody>
						<?php 
							$index = 0;
						foreach($orderdetails as $detail) {
							$index ++;
						?>
						<tr>
							<td style="text-align:center"><?php echo $index?></td>
							<td style="text-align:left"><?php echo $detail['productname']?>&nbsp;</td>
							<td style="text-align:center"><?php echo $detail['qty']?>&nbsp;</td>
							<td style="text-align:right">$<?php echo $detail['netprice']?>&nbsp;</td>
							<td style="text-align:right">$<?php echo $detail['subtotal']?>&nbsp;</td>
							<td style="text-align:center"><?php echo $detail['tax']?>%&nbsp;</td>
							<td style="text-align:right">$<?php echo $detail['grandtotal']?>&nbsp;</td>
						</tr>
						<?php
							}
						?>
					
					</tbody>
				</table>
				<br>
				<table width="300px" style="font-weight:bold" align="right">
					<tr>
						<td><label style="float:right; width:100px; font-weight:bold"><?php echo $this->document->text['text_subtotal']?> : </label></td>
						<td style="text-align:right">$<?php echo $order['subtotal']?></td>
					</tr>
					<tr>
						<td><label style="float:right; width:100px; font-weight:bold"><?php echo $this->document->text['text_taxamount']?> : </label></td>
						<td style="text-align:right">$<?php echo $order['taxamount']?></td>
					</tr>
					<tr>
						<td><label style="float:right; width:100px; font-weight:bold"><?php echo $this->document->text['text_discount']?> : </label></td>
						<td style="text-align:right">$<?php echo $order['discountamount']?></td>
					</tr>
					<tr>
						<td colspan="2"><hr /></td>
					</tr>
					<tr>
						<td><label style="float:right; width:100px; font-weight:bold; font-size:12pt">Grand total : </label></td>
						<td style="text-align:right; font-size:12pt">$<?php echo $order['grandtotal']?></td>
					</tr>
				</table>

				<div style="clear:both">&nbsp;</div>
				<table class="sign" width="100%">
					<tbody>
						<tr>
							<td valign="top">
								Vendor Signoff<br>
								Date : ..../..../.........
							</td>
							<td valign="top"><?php echo $this->document->text['text_creator']?><br>
								Date : ..../..../.........
							</td>
							<td valign="top">Accountant
								<br>
								Date : ..../..../.........
							</td>
							<td valign="top">Director
								<br>
								Date : ..../..../.........
								<br />
<br />
<br />
<br />
<br />
<br />

							</td>
						</tr>
					</tbody>
				</table>							
			</td>
		</tr>
	</tbody>
	
</table>



<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:10pt}
table{font-size:11pt}
table th{font-weight:bold; text-align:left}
.grid td{ border:1px dotted #CCCCCC}
.grid th{ text-align:center; border:1px dotted #999999}
.sign td{width:25%; text-align:center; font-weight:bold}
</style>

<script src="<?php echo DIR_JS?>jquery.js" type="text/javascript"></script>
<script>
	$(document).ready(function(){
		window.print();
	});
</script>

<?php } else  {?>
<h1>Occur Error!</h1>
<?php } ?>

